package com.azier.kapacitor.script.node;

import com.azier.kapacitor.script.method.*;
import com.azier.kapacitor.script.node.nodebind.*;
import com.azier.kapacitor.script.node.nodebind.qlnodebind.*;

import java.util.ArrayList;

/**
* 1 * @Author: luoj
* 2 * @Date: 2019/11/8 11:27
* 3
*/

/**
Create an alert node, which can trigger alerts.
**/
/**
创建一个警报节点，它可以触发警报。
**/
public class AlertNode extends AbstractNode implements AlertNodeBind, BarrierNodeBind, BottomNodeBind, ChangeDetectNodeBind, CombineNodeBind,
        CountNodeBind, CumulativeSumNodeBind, DefaultNodeBind, DeleteNodeBind, DerivativeNodeBind, DifferenceNodeBind, DistinctNodeBind,
        Ec2AutoscaleNodeBind, ElapsedNodeBind, EvalNodeBind, FirstNodeBind, FlattenNodeBind, GroupByNodeBind, HoltWintersNodeBind,
        HoltWintersWithFitNodeBind, HttpOutNodeBind, HttpPostNodeBind, InfluxDBOutNodeBind, JoinNodeBind, K8sAutoscaleNodeBind,
        KapacitorLoopbackNodeBind, LastNodeBind, MaxNodeBind, MeanNodeBind, MedianNodeBind, MinNodeBind, ModeNodeBind,
        MovingAverageNodeBind, PercentileNodeBind, SampleNodeBind, ShiftNodeBind, SideloadNodeBind, SpreadNodeBind, StateCountNodeBind,
        StateDurationNodeBind, StatsNodeBind, StddevNodeBind, SumNodeBind, SwarmAutoscaleNodeBind, TopNodeBind, UnionNodeBind, WhereNodeBind,
        WindowNodeBind{
    private static final String name = "alert";

    public AlertNode() {
        super(new ArrayList<>(),new ArrayList<>(),name);
    }

    /**
    Send the alert to Alerta.
    将警报发送到Alerta。
    **/
    public AlertNode alerta(){
        Alerta alerta = new Alerta();
        super.addMethod(alerta);
        return this;
    }
    /**
    Indicates an alert should trigger only if all points in a batch match the criteria. Does not apply to stream alerts.

    指示仅当批次中的所有点均符合条件时才触发警报。不适用于流警报。
    **/
    public AlertNode all(){
        All all = new All();
        super.addMethod(all);
        return this;
    }
    /**
    Filter expression for the CRITICAL alert level. An empty value indicates the level is invalid and is skipped.
    **/
    /**
    筛选CRITICAL警报级别的表达式。空值表示该级别无效并且被跳过。
    **/
    public AlertNode crit(String condition){
        Crit crit = new Crit(condition);
        super.addMethod(crit);
        return this;
    }
    /**
    Filter expression for resetting the CRITICAL alert level to lower level.
    **/
    /**
    筛选器表达式，用于将CRITICAL警报级别重置为较低级别。
    **/
    public AlertNode critReset(String condition){
        CritReset critReset = new CritReset(condition);
        super.addMethod(critReset);
        return this;
    }
    /**
    Template for constructing a detailed HTML message for the alert. The same template data is available as the AlertNode.Message property, in addition to a Message field that contains the rendered Message value.
    **/
    /**
    用于构造警报的详细HTML消息的模板。除了包含呈现的Message值的Message字段之外，可以使用相同的模板数据作为AlertNode.Message属性。
    **/
    public AlertNode details(String alert){
        Details details = new Details(alert);
        super.addMethod(details);
        return this;
    }
    /**
    Optional field key to add the alert duration to the data. The duration is always in units of nanoseconds.
    **/
    /**
    可选字段键，用于将警报持续时间添加到数据中。持续时间始终以纳秒为单位。
    **/
    public AlertNode durationField(String alert){
        DurationField durationField = new DurationField(alert);
        super.addMethod(durationField);
        return this;
    }
    /**
    Email the alert data.
    **/
    /**
    通过电子邮件发送警报数据。
    **/
    public AlertNode email(String ...to){
        Email email = new Email(to);
        super.addMethod(email);
        return this;
    }
    /**
    Execute a command whenever an alert is triggered and pass the alert data over STDIN in JSON format.
    **/
    /**
    每当触发警报时执行一条命令，并通过STDIN以JSON格式传递警报数据。
    **/
    public AlertNode exec(String executable, String... args){
        Exec exec = new Exec(executable, args);
        super.addMethod(exec);
        return this;
    }
    /**
    Perform flap detection on the alerts. The method used is similar method to Nagios: https://assets.nagios.com/downloads/nagioscore/docs/nagioscore/3/en/flapping.html
    **/
    /**
    对警报执行襟翼检测。所使用的方法与Nagios相似：https：//assets.nagios.com/downloads/nagioscore/docs/nagioscore/3/en/flapping.html
    **/
    public AlertNode flapping(double high, double low){
        Flapping flapping = new Flapping(high, low);
        super.addMethod(flapping);
        return this;
    }
    /**
    Send the alert to HipChat.
    **/
    /**
    将警报发送到HipChat。
    **/
    public AlertNode hipChat(){
        HipChat hipChat = new HipChat();
        super.addMethod(hipChat);
        return this;
    }
    /**
    Number of previous states to remember when computing flapping levels and checking for state changes. Minimum value is 2 in order to keep track of current and previous states.
    **/
    /**
    计算拍动级别并检查状态变化时要记住的先前状态数。最小值是2，以便跟踪当前和以前的状态。
    **/
    public AlertNode history(long alert){
        History history = new History(alert);
        super.addMethod(history);
        return this;
    }
    /**
    Template for constructing a unique ID for a given alert.
    **/
    /**
    用于为给定警报构造唯一ID的模板。
    **/
    public AlertNode id(String alert){
        Id id = new Id(alert);
        super.addMethod(id);
        return this;
    }
    /**
    Optional field key to add to the data, containing the alert ID as a string.
    **/
    /**
    要添加到数据中的可选字段键，以字符串形式包含警报ID。
    **/
    public AlertNode idField(String alert){
        IdField idField = new IdField(alert);
        super.addMethod(idField);
        return this;
    }
    /**
    Optional tag key to use when tagging the data with the alert ID.
    **/
    /**
    在使用警报ID标记数据时使用的可选标记键。
    **/
    public AlertNode idTag(String alert){
        IdTag idTag = new IdTag(alert);
        super.addMethod(idTag);
        return this;
    }
    /**
    Filter expression for the INFO alert level. An empty value indicates the level is invalid and is skipped.
    **/
    /**
    INFO警报级别的过滤器表达式。空值表示该级别无效并且被跳过。
    **/
    public AlertNode info(String condition){
        Info info = new Info(condition);
        super.addMethod(info);
        return this;
    }
    /**
    Inhibit other alerts in a category. The equal tags provides a list of tags that must be equal in order for an alert event to be inhibited.
    **/
    /**
    禁止类别中的其他警报。 equal标签提供了一个列表，这些标签必须相等才能禁止警报事件。
    **/
    public AlertNode inhibit(String category, String... equalTags){
        Inhibit inhibit = new Inhibit(category, equalTags);
        super.addMethod(inhibit);
        return this;
    }
    /**
    Filter expression for resetting the INFO alert level to lower level.
    **/
    /**
    筛选器表达式，用于将INFO警报级别重置为较低级别。
    **/
    public AlertNode infoReset(String condition){
        InfoReset infoReset = new InfoReset(condition);
        super.addMethod(infoReset);
        return this;
    }
    /**
    Send the alert to a Kafka cluster.
    **/
    /**
    将警报发送到Kafka群集。
    **/
    public AlertNode kafka(){
        Kafka kafka = new Kafka();
        super.addMethod(kafka);
        return this;
    }
    /**
    Optional field key to add to the data, containing the alert level as a string.
    **/
    /**
    要添加到数据中的可选字段键，以字符串形式包含警报级别。
    **/
    public AlertNode levelField(String alert){
        LevelField levelField = new LevelField(alert);
        super.addMethod(levelField);
        return this;
    }
    /**
    Optional tag key to use when tagging the data with the alert level.
    **/
    /**
    在使用警报级别标记数据时使用的可选标记键。
    **/
    public AlertNode levelTag(String alert){
        LevelTag levelTag = new LevelTag(alert);
        super.addMethod(levelTag);
        return this;
    }
    /**
    Log JSON alert data to file. One event per line. Must specify the absolute path to the log file. It will be created if it does not exist. Example: stream
    **/
    /**
    将JSON警报数据记录到文件中。每行一个事件。必须指定日志文件的绝对路径。如果不存在，将创建它。示例：流
    **/
    public AlertNode log(String filepath){
        Log log = new Log(filepath);
        super.addMethod(log);
        return this;
    }
    /**
    Template for constructing a meaningful message for the alert.
    **/
    /**
    用于为警报构造有意义的消息的模板。
    **/
    public AlertNode message(String alert){
        Message message = new Message(alert);
        super.addMethod(message);
        return this;
    }
    /**
    Optional field key to add to the data, containing the alert message.
    **/
    /**
    要添加到数据中的可选字段键，包含警报消息。
    **/
    public AlertNode messageField(String alert){
        MessageField messageField = new MessageField(alert);
        super.addMethod(messageField);
        return this;
    }
    /**
    Send alert to an MQTT broker
    **/
    /**
    发送警报给MQTT经纪人
    **/
    public AlertNode mqtt(String topic){
        Mqtt mqtt = new Mqtt(topic);
        super.addMethod(mqtt);
        return this;
    }
    /**
    Do not send recovery alerts.
    **/
    /**
    不要发送恢复警报。
    **/
    public AlertNode noRecoveries(){
        NoRecoveries noRecoveries = new NoRecoveries();
        super.addMethod(noRecoveries);
        return this;
    }
    /**
    Send alert to OpsGenie using OpsGenie’s v1 API. (Deprecated)
    **/
    /**
    使用OpsGenie的v1 API将警报发送到OpsGenie。 （已弃用）
    **/
    public AlertNode opsGenie(){
        OpsGenie opsGenie = new OpsGenie();
        super.addMethod(opsGenie);
        return this;
    }
    /**
    Send alert to OpsGenie using OpsGenie’s v2 API.
    **/
    /**
    使用OpsGenie的v2 API将警报发送到OpsGenie。
    **/
    public AlertNode opsGenie2(){
        OpsGenie2 opsGenie2 = new OpsGenie2();
        super.addMethod(opsGenie2);
        return this;
    }
    /**
    Send the alert to PagerDuty using PagerDuty’s v1 API. (Deprecated)
    **/
    /**
    使用PagerDuty的v1 API将警报发送到PagerDuty。 （已弃用）
    **/
    public AlertNode pagerDuty(){
        PagerDuty pagerDuty = new PagerDuty();
        super.addMethod(pagerDuty);
        return this;
    }
    /**
    Send the alert to PagerDuty using PagerDuty’s v2 API.
    **/
    /**
    使用PagerDuty的v2 API将警报发送到PagerDuty。
    **/
    public AlertNode pagerDuty2(){
        PagerDuty2 pagerDuty2 = new PagerDuty2();
        super.addMethod(pagerDuty2);
        return this;
    }
    /**
    HTTP POST JSON alert data to a specified URL.
    **/
    /**
    HTTP POST JSON警报数据到指定的URL。
    **/
    public AlertNode post(String ...urls){
        Post post = new Post(urls);
        super.addMethod(post);
        return this;
    }
    /**
    Send the alert to Pushover.
    **/
    /**
    将警报发送到Pushover。
    **/
    public AlertNode pushover(){
        Pushover pushover = new Pushover();
        super.addMethod(pushover);
        return this;
    }
    /**
    Suppresses all error logging events from this node.
    **/
    /**
    禁止来自此节点的所有错误记录事件。
    **/
    public AlertNode quiet(){
        Quiet quiet = new Quiet();
        super.addMethod(quiet);
        return this;
    }
    /**
    Send the alert to Sensu.
    **/
    /**
    将警报发送给Sensu。
    **/
    public AlertNode sensu(){
        Sensu sensu = new Sensu();
        super.addMethod(sensu);
        return this;
    }
    /**
    Send the alert to Slack.
    **/
    /**
    将警报发送到Slack。
    **/
    public AlertNode slack(){
        Slack slack = new Slack();
        super.addMethod(slack);
        return this;
    }
    /**
    Send the alert using SNMP traps.
    **/
    /**
    使用SNMP陷阱发送警报。
    **/
    public AlertNode snmpTrap(String trapOid){
        SnmpTrap snmpTrap = new SnmpTrap(trapOid);
        super.addMethod(snmpTrap);
        return this;
    }
    /**
    Only sends events where the state changed. Each different alert level OK, INFO, WARNING, and CRITICAL are considered different states.
    **/
    /**
    仅发送状态更改的事件。每个不同的警报级别OK，INFO，WARNING和CRITICAL被认为是不同的状态。
    **/
    public AlertNode stateChangesOnly(long interval, String durationLiteral){
        StateChangesOnly stateChangesOnly = new StateChangesOnly(interval, durationLiteral);
        super.addMethod(stateChangesOnly);
        return this;
    }
    /**
    Send the alert to Talk.
    **/
    /**
    将提醒发送给Talk。
    **/
    public AlertNode talk(){
        Talk talk = new Talk();
        super.addMethod(talk);
        return this;
    }
    /**
    Send JSON alert data to a specified address over TCP.
    **/
    /**
    通过TCP将JSON警报数据发送到指定地址。
    **/
    public AlertNode tcp(String address){
        Tcp tcp = new Tcp(address);
        super.addMethod(tcp);
        return this;
    }
    /**
    Send the alert to Telegram.
    **/
    /**
    将警报发送给Telegram。
    **/
    public AlertNode telegram(){
        Telegram telegram = new Telegram();
        super.addMethod(telegram);
        return this;
    }
    /**
    Topic specifies the name of an alert topic to which, alerts will be published. Alert handlers can be configured per topic, see the API documentation.
    **/
    /**
    主题指定警报主题的名称，警报将发布到该主题。可以按主题配置警报处理程序，请参阅API文档。
    **/
    public AlertNode topic(String alert){
        Topic topic = new Topic(alert);
        super.addMethod(topic);
        return this;
    }
    /**
    Send alert to VictorOps.
    **/
    /**
    发送警报到VictorOps。
    **/
    public AlertNode victorOps(){
        VictorOps victorOps = new VictorOps();
        super.addMethod(victorOps);
        return this;
    }
    /**
    Filter expression for the WARNING alert level. An empty value indicates the level is invalid and is skipped.
    **/
    /**
    过滤警告警报级别的表达式。空值表示该级别无效并且被跳过。
    **/
    public AlertNode warn(String condition){
        Warn warn = new Warn(condition);
        super.addMethod(warn);
        return this;
    }
    /**
    Filter expression for resetting the WARNING alert level to lower level.
    **/
    /**
    过滤表达式，用于将“警告”警报级别重置为较低级别。
    **/
    public AlertNode warnReset(String condition){
        WarnReset warnReset = new WarnReset(condition);
        super.addMethod(warnReset);
        return this;
    }
}